
#include "S_25_AirConditionerDevMode_doSet.h"
#include "mi_iid_define.h"
#include "spec.h"
#include "main.h"
#include "section1_set_func.h"

static void P_25_1_CoolingEffect_doSet(property_operation_t *o)
{
    // 判断数据格式是否正确，如果错误，返回代码: OPERATION_ERROR_VALUE
    if (o->value.format != PROPERTY_FORMAT_NUMBER)
    {
        o->code = OPERATION_ERROR_VALUE;
        return;
    }

    // 简单判断数据取值范围是否合法，如果不合法，返回代码: OPERATION_ERROR_VALUE
    if (o->value.data.number.value.integerValue < 1 || o->value.data.number.value.integerValue > 5)
    {
        o->code = OPERATION_ERROR_VALUE;
        return;
    }

    // TODO: 执行写操作: o->value.data.number.value.integerValue;

	LOG_INFO("%s, %ld\r\n",__func__,o->value.data.number.value.integerValue);
	
	
    // 如果成功，返回代码: OPERATION_OK
    o->code = OPERATION_OK;
  
	A25_25_1_Set(o->value.data.number.value.integerValue);		
//	BeepStart();	
    //上报状态，通知app状态变化，统一APP修改、定时器触发后的上报机制
//    P_25_1_CoolingEffect_doChange_notify(o->value.data.number.value.integerValue);

    return;
}

static void P_25_2_HeatingEffect_doSet(property_operation_t *o)
{
    // 判断数据格式是否正确，如果错误，返回代码: OPERATION_ERROR_VALUE
    if (o->value.format != PROPERTY_FORMAT_NUMBER)
    {
        o->code = OPERATION_ERROR_VALUE;
        return;
    }

    // 简单判断数据取值范围是否合法，如果不合法，返回代码: OPERATION_ERROR_VALUE
    if (o->value.data.number.value.integerValue < 1 || o->value.data.number.value.integerValue > 5)
    {
        o->code = OPERATION_ERROR_VALUE;
        return;
    }

    // TODO: 执行写操作: o->value.data.number.value.integerValue;

	LOG_INFO("%s, %ld\r\n",__func__,o->value.data.number.value.integerValue);
	
    // 如果成功，返回代码: OPERATION_OK
    o->code = OPERATION_OK;

	A26_25_2_Set(o->value.data.number.value.integerValue);
//	BeepStart();
    //上报状态，通知app状态变化，统一APP修改、定时器触发后的上报机制
//    P_25_2_HeatingEffect_doChange_notify(o->value.data.number.value.integerValue);

    return;
}

static void P_25_3_RelieveAirDeflectorCondensation_doSet(property_operation_t *o)
{
    // 判断数据格式是否正确，如果错误，返回代码: OPERATION_ERROR_VALUE
    if (o->value.format != PROPERTY_FORMAT_BOOLEAN)
    {
        o->code = OPERATION_ERROR_VALUE;
        return;
    }

    // TODO: 执行写操作: o->value.data.boolean.value;

	LOG_INFO("%s, %d\r\n",__func__,o->value.data.boolean.value);
	
    // 如果成功，返回代码: OPERATION_OK
    o->code = OPERATION_OK;
  
	A05_25_3_Set(o->value.data.boolean.value);
//	BeepStart();
    //上报状态，通知app状态变化，统一APP修改、定时器触发后的上报机制
//    P_25_3_RelieveAirDeflectorCondensation_doChange_notify(o->value.data.boolean.value);

    return;
}

static void P_25_4_CoolingOutdoorFanNoiseReduction_doSet(property_operation_t *o)
{
    // 判断数据格式是否正确，如果错误，返回代码: OPERATION_ERROR_VALUE
    if (o->value.format != PROPERTY_FORMAT_BOOLEAN)
    {
        o->code = OPERATION_ERROR_VALUE;
        return;
    }

    // TODO: 执行写操作: o->value.data.boolean.value;

	LOG_INFO("%s, %d\r\n",__func__,o->value.data.boolean.value);
	
    // 如果成功，返回代码: OPERATION_OK
    o->code = OPERATION_OK;
 
	A05_25_4_Set(o->value.data.boolean.value);		
//	BeepStart();	
    //上报状态，通知app状态变化，统一APP修改、定时器触发后的上报机制
//    P_25_4_CoolingOutdoorFanNoiseReduction_doChange_notify(o->value.data.boolean.value);
	
    return;
}

static void P_25_5_CoolingIndoorFanNoiseReduction_doSet(property_operation_t *o)
{
    // 判断数据格式是否正确，如果错误，返回代码: OPERATION_ERROR_VALUE
    if (o->value.format != PROPERTY_FORMAT_BOOLEAN)
    {
        o->code = OPERATION_ERROR_VALUE;
        return;
    }

    // TODO: 执行写操作: o->value.data.boolean.value;

	LOG_INFO("%s, %d\r\n",__func__,o->value.data.boolean.value);
	
    // 如果成功，返回代码: OPERATION_OK
    o->code = OPERATION_OK;
  A05_25_5_Set(o->value.data.boolean.value);
//  BeepStart();		
    //上报状态，通知app状态变化，统一APP修改、定时器触发后的上报机制
//    P_25_5_CoolingIndoorFanNoiseReduction_doChange_notify(o->value.data.boolean.value);

    return;
}

static void P_25_6_HeatingOutdoorFanNoiseReduction_doSet(property_operation_t *o)
{
    // 判断数据格式是否正确，如果错误，返回代码: OPERATION_ERROR_VALUE
    if (o->value.format != PROPERTY_FORMAT_BOOLEAN)
    {
        o->code = OPERATION_ERROR_VALUE;
        return;
    }

    // TODO: 执行写操作: o->value.data.boolean.value;

	LOG_INFO("%s, %d\r\n",__func__,o->value.data.boolean.value);
	
    // 如果成功，返回代码: OPERATION_OK
    o->code = OPERATION_OK;
  
	A06_25_6_Set(o->value.data.boolean.value);	
//	BeepStart();		
    //上报状态，通知app状态变化，统一APP修改、定时器触发后的上报机制
//    P_25_6_HeatingOutdoorFanNoiseReduction_doChange_notify(o->value.data.boolean.value);

    return;
}

static void P_25_7_HeatingIndoorFanNoiseReduction_doSet(property_operation_t *o)
{
    // 判断数据格式是否正确，如果错误，返回代码: OPERATION_ERROR_VALUE
    if (o->value.format != PROPERTY_FORMAT_BOOLEAN)
    {
        o->code = OPERATION_ERROR_VALUE;
        return;
    }

    // TODO: 执行写操作: o->value.data.boolean.value;

	LOG_INFO("%s, %d\r\n",__func__,o->value.data.boolean.value);
	
    // 如果成功，返回代码: OPERATION_OK
    o->code = OPERATION_OK;
  
	A06_25_7_Set(o->value.data.boolean.value);
//  BeepStart();		
    //上报状态，通知app状态变化，统一APP修改、定时器触发后的上报机制
//    P_25_7_HeatingIndoorFanNoiseReduction_doChange_notify(o->value.data.boolean.value);

    return;
}

void S_25_AirConditionerDevMode_doSet(property_operation_t *o)
{
    switch (o->piid)
    {
        case PIID_25_1_CoolingEffect:
            P_25_1_CoolingEffect_doSet(o);
            break;

        case PIID_25_2_HeatingEffect:
            P_25_2_HeatingEffect_doSet(o);
            break;

        case PIID_25_3_RelieveAirDeflectorCondensation:
            P_25_3_RelieveAirDeflectorCondensation_doSet(o);
            break;

        case PIID_25_4_CoolingOutdoorFanNoiseReduction:
            P_25_4_CoolingOutdoorFanNoiseReduction_doSet(o);
            break;

        case PIID_25_5_CoolingIndoorFanNoiseReduction:
            P_25_5_CoolingIndoorFanNoiseReduction_doSet(o);
            break;

        case PIID_25_6_HeatingOutdoorFanNoiseReduction:
            P_25_6_HeatingOutdoorFanNoiseReduction_doSet(o);
            break;

        case PIID_25_7_HeatingIndoorFanNoiseReduction:
            P_25_7_HeatingIndoorFanNoiseReduction_doSet(o);
            break;

        default:
            o->code = OPERATION_ERROR_VALUE;
            break;
    }
}
